iconhelper: Invalidate style before accessing texture
authorBenjamin Otte <otte@redhat.com>
Fri, 23 Dec 2016 22:16:30 +0000 (23:16 +0100)
committerBenjamin Otte <otte@redhat.com>
Sat, 24 Dec 2016 05:19:16 +0000 (06:19 +0100)
Invalidating the style might cause invalidation of the texture. So we
end up with a pointer to freed memory.
SAD!

gtk/gtkiconhelper.c

index 82576fd7baa6a66173be3cc51ae9285c46f05199..9f3cdb1fd6c377499c58c6d8b24ee543f1edc606 100644 (file)
@@ -873,13 +873,13 @@ gtk_icon_helper_snapshot (GtkIconHelper *self,
   GtkCssStyle *style;
   GskTexture *texture;
 
+  style = gtk_css_node_get_style (gtk_css_gadget_get_node (GTK_CSS_GADGET (self)));
+
   gtk_icon_helper_ensure_texture (self);
   texture = self->priv->texture;
   if (texture == NULL)
     return;
  
-  style = gtk_css_node_get_style (gtk_css_gadget_get_node (GTK_CSS_GADGET (self)));
-
   gtk_css_style_snapshot_icon_texture (style,
                                        snapshot,
                                        texture,